﻿CREATE PROCEDURE [sp_ssiscatalog].[log_usage]
	@action											NVARCHAR(MAX)
,	@exec_id										BIGINT			=	NULL
,	@exec_execution									BIT				=	NULL
,	@exec_events									BIT				=	NULL
,	@exec_errors									BIT				=	NULL
,	@exec_warnings									BIT				=	NULL
,	@exec_executable_stats							BIT				=	NULL
,	@exec_events_packages_excluded_isspecified		BIT				=	NULL
,	@execs_folder_name_isspecified					BIT				=	NULL
,	@execs_project_name_isspecified					BIT				=	NULL
,	@execs_package_name_isspecified					BIT				=	NULL
,	@execs_executed_as_name_isspecified				BIT				=	NULL
,	@execs_status_desc_isspecified					BIT				=	NULL
,	@execs_maximum_execution_id_isspecified			BIT				=	NULL
,	@execs_minimum_execution_id_isspecified			BIT				=	NULL
,	@configure_collect_usage_stats					BIT				=	NULL
,	@show_docs										BIT				=	NULL
,	@show_docs_only									BIT				=	NULL
AS
BEGIN
		INSERT	[sp_ssiscatalog].[usage_stats]([usage_stats_id],[user_name],[date_time],[action]
								,	[exec_id],[exec_execution],[exec_events],[exec_errors],[exec_warnings]
								,	[exec_executable_stats],[exec_events_packages_excluded_isspecified]
								,	[execs_folder_name_isspecified],[execs_project_name_isspecified]
								,	[execs_package_name_isspecified],[execs_executed_as_name_isspecified]
								,	[execs_status_desc_isspecified],[execs_maximum_execution_id_isspecified]
								,	[execs_minimum_execution_id_isspecified],[show_docs],[show_docs_only]
								,	[configure_collect_usage_stats])
		VALUES	(NEXT VALUE FOR [sp_ssiscatalog].[seq],SUSER_NAME(),CONVERT(SMALLDATETIME,CURRENT_TIMESTAMP),@action
				,	@exec_id,@exec_execution,@exec_events,@exec_errors,@exec_warnings
				,	@exec_executable_stats,@exec_events_packages_excluded_isspecified
				,	@execs_folder_name_isspecified,@execs_project_name_isspecified
				,	@execs_package_name_isspecified,@execs_executed_as_name_isspecified
				,	@execs_status_desc_isspecified,@execs_maximum_execution_id_isspecified
				,	@execs_minimum_execution_id_isspecified,@show_docs,@show_docs_only,@configure_collect_usage_stats
		);
END